/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50537
 Source Host           : localhost
 Source Database       : xiaoqu

 Target Server Type    : MySQL
 Target Server Version : 50537
 File Encoding         : utf-8

 Date: 06/04/2014 19:11:56 PM
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;


-- ----------------------------
--  Table structure for `xq_comment`
-- ----------------------------
DROP TABLE IF EXISTS `xq_comment`;
CREATE TABLE `xq_comment` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` text NOT NULL,
  `createDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `target` int(11) NOT NULL,
  `targetId` int(11) NOT NULL,
  `userId` int(11) NOT NULL,
  `parentId` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for xq_topic
-- ----------------------------
DROP TABLE IF EXISTS `xq_topic`;
CREATE TABLE `xq_topic` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '帖子id',
  `title` varchar(255) DEFAULT NULL COMMENT '帖子标题',
  `content` varchar(255) DEFAULT NULL COMMENT '帖子内容',
  `type` varchar(255) DEFAULT NULL COMMENT '帖子类型',
  `parentId` bigint(20) DEFAULT NULL COMMENT '父贴id(若无则为主贴)',
  `userId` bigint(20) DEFAULT NULL COMMENT '发贴用户id',
  `xiaoQuId` bigint(20) DEFAULT NULL,
  `sendTime` datetime DEFAULT NULL COMMENT '发送时间',
  `readNum` bigint(20) DEFAULT NULL COMMENT '阅读数量(只有父贴有)',
  `feedbackNum` bigint(20) DEFAULT NULL COMMENT '回复数量(只有父贴有)',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
--  Table structure for `xq_login_token`
-- ----------------------------
DDROP TABLE IF EXISTS `xq_login_token`;
CREATE TABLE `xq_login_token` (
  `token` varchar(255) NOT NULL,
  `userId` int(11) NOT NULL,
  `createDate` datetime NOT NULL,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `xq_user`
-- ----------------------------
DROP TABLE IF EXISTS `xq_user`;
CREATE TABLE `xq_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `phone` bigint(20) NOT NULL COMMENT '手机号码，登录用户名',
  `xiaoQuId` int(11) NOT NULL,
  `unit` int(11) DEFAULT NULL,
  `room` int(11) DEFAULT NULL,
  `nick` varchar(255) DEFAULT NULL COMMENT '昵称',
  `password` varchar(255) NOT NULL,
  `portrait` varchar(255) DEFAULT NULL COMMENT '头像',
  `registerDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '注册时间',
  PRIMARY KEY (`id`,`phone`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `xq_user`
-- ----------------------------
BEGIN;
INSERT INTO `xq_user` VALUES ('1', '159', '1', '143', '802', 'he dashi', '1', null, '0000-00-00 00:00:00');
COMMIT;

-- ----------------------------
--  Table structure for `xq_xiaoqu`
-- ----------------------------
DROP TABLE IF EXISTS `xq_xiaoqu`;
CREATE TABLE `xq_xiaoqu` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `longitude` double NOT NULL,
  `latitude` double NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `createdBy` int(11) NOT NULL DEFAULT '1' COMMENT '小区是谁创建的。1代表系统创建， 2代表是用户创建（用户创建的longitude 和 latitude都是假数据）',
  `lbsId` bigint(11) NOT NULL COMMENT '百度云上对应的记录的ID',
  `createDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `xq_xiaoqu`
-- ----------------------------
BEGIN;
INSERT INTO `xq_xiaoqu` VALUES ('1', '保利西子湾', '121.241256', '31.066875', '松江区广富林路1188弄 ', '1', '249059745', '2014-06-13 13:30:34'), ('12', '三湘四季花城', '121.236109', '31.058669', '松江广富林路1599弄、梅家浜路1508弄 ', '1', '253038192', '2014-06-13 13:24:27'), ('13', '御上海', '121.242148', '31.054949', '谷阳北路2399弄梅家浜路1493弄', '1', '249149744', '2014-06-13 13:27:48'), ('14', '龙湖好望山', '121.228313', '31.060688', '人民北路2908弄277-1110室 ', '1', '253055881', '2014-06-13 13:30:34'), ('15', '绿地蔷薇九里', '121.236631', '31.057331', '广富林路1518弄369号 ', '1', '253059941', '2014-06-13 13:32:35'), ('16', '星辰园', '121.236631', '31.057331', '新城区梅家浜路1505弄41号', '1', '253071416', '2014-06-13 13:37:00');
COMMIT;

-- ----------------------------
--  Table structure for `xq_shop`
-- ----------------------------
DROP TABLE IF EXISTS `xq_shop`;
CREATE TABLE `xq_shop` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `address` varchar(255) NOT NULL,
  `phones` varchar(255) DEFAULT NULL COMMENT '联系方式，电话之类的，逗号分隔',
  `xiaoQuId` int(11) DEFAULT NULL COMMENT '最靠近的小区，这个不是必须的',
  `detail` varchar(255) NOT NULL COMMENT '具体介绍',
  `images` varchar(255) DEFAULT NULL COMMENT '商店的相片，逗号分隔',
  `latitude` double NOT NULL COMMENT '精确的位置',
  `longtitude` double NOT NULL COMMENT '精确的位置',
  `createDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建的时间',
  `tags` varchar(255) NOT NULL COMMENT '店面类型 如 饭店 超市 水粮油等',
  `lbsId` bigint(20) NOT NULL COMMENT '百度云上对应的记录的ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

SET FOREIGN_KEY_CHECKS = 1;
